## Drawing Fig9(d)
import matplotlib.pyplot as plt
from matplotlib import rcParams

plt.rcParams['figure.dpi'] = 1200
fr = open("DrawingFig9(c)(d).csv", "r")
ls = []
for line in fr:
    line = line.replace("\n","")
    ls.append(line.split(","))
fr.close()

x_start = -3.0
x_end = 53.0
y_start = 0.0
y_end = 0.09
x1, x2, x3 = [], [], []
y4, y5, y6 = [], [], []
iLen, jLen = len(ls), len(ls[0])
for i in range(1, iLen):
    if int(ls[i][1]) == 200:
        x1.append(float(ls[i][0]))
        y4.append(float(ls[i][6]))
    elif int(ls[i][1]) == 500:
        x2.append(float(ls[i][0]))
        y5.append(float(ls[i][6]))
    elif int(ls[i][1]) == 1000:
        x3.append(float(ls[i][0]))
        y6.append(float(ls[i][6]))

plt.figure(figsize=(6.0, 4.0))
plt.xlim(x_start-0.01, x_end+0.01)
plt.ylim(y_start-0.005, y_end+0.005)
plt.xticks([0, 10, 20, 30, 40, 50], ['0', '10', '20', '30', '40', '50'])
plt.plot(x1, y4, "r.-", label="$L = 200$", linewidth=1)
plt.plot(x2, y5, "g.-", label="$L = 500$", linewidth=1)
plt.plot(x3, y6, "b.-", label="$L = 1000$", linewidth=1)
plt.xlabel('$r$')
plt.ylabel('$Std$')
plt.legend()

plt.savefig("Fig9(d).jpg")
plt.show()
